from public.action import *
from public.business import *
from public.testData import *
from public.tools import *

testCase = "DBshop015_添加侧边设置"

name="网站很好看"
firefox=openBrowser(urlAdmin) #调用函数打开指定网址,并且获取函数的返回值,函数返回的是浏览器的对象
DBshopLoginAdmin(firefox) #调用函数登录dbshop的后台
DBshopEnterMenu3(firefox,"商品管理","管理分类","前台侧边设置")
# 添加侧边显示
firefox.find_element_by_xpath('//a[contains(.,"添加侧边显示")]').click()

#
firefox.find_element_by_id("frontside_name").send_keys(name)
firefox.find_element_by_id("frontside_sort").clear()
firefox.find_element_by_id("frontside_sort").send_keys("255")
# 保存
firefox.find_element_by_xpath('//button[contains(.,"保存侧边显示信息")]').click()

a=firefox.find_element_by_xpath('//td[contains(.,name)]').text
# 断言
if a==name:
    writeLog("%s 测试通过" % testCase)
else:
   writeLog("%s 测试失败" % testCase)
   getPhoto(firefox)
firefox.quit()